/**
 * Created by Administrator on 2016/6/29 0029.
 */
$().ready(function(){
    $.ajax({
        type: "get",
        url: MPJ.apiBase+'/mpj2shop/docroot/en/district_cnc.xml',
        dataType: "xml",
        async: false,
        success: function (obj) {
            var district_Arr = [];
            $(obj).find('REGION').each(function (i) {
                var region_Arr = {};
                region_Arr.id = $(this).attr('id');
                region_Arr.name = $(this).children('Name').text();
                $region = $(obj).find('REGION').eq(i);
                var district = [];
                $region.find('DISTRICT').each(function (j) {
                    var district_Arr_next = {};
                    district_Arr_next.id = $(this).attr('id');
                    district_Arr_next.name = $(this).children('Name').text();
                    district.push(district_Arr_next);

                    var cnc_ind  = [];
                    $(this).find('CNC_IND').each(function (k) {
                        var cnc_ind_Arr_next = {};
                        cnc_ind_Arr_next.id = $(this).attr('id');
                        cnc_ind_Arr_next.name = $(this).children('Name').text();
                        cnc_ind.push(cnc_ind_Arr_next);
                    })
                    district_Arr_next.cnc_ind = cnc_ind;
                })
                region_Arr.district = district;
                district_Arr.push(region_Arr);
            })
            sessionStorage.setItem('district_Arr', JSON.stringify(district_Arr));

        },
        error: function () {

        }
    });
})
